home *** CD-ROM | disk | FTP | other *** search
/ Virtual Sex With Asia / Virtual Sex With Asia.iso / mac / Virtual Sex with Asia.Dxr / 00028.ls < prev    next >
Encoding:
Text File  |  1997-09-07  |  5.7 KB  |  220 lines

  1. global gMachineType, fixPal, gWhichInterface, gMovieSprite, gPathName, gFileName, gFolderList, gFileList, gDirList, gDxrList, gCstList, gIniList, gDllList, gTxtList, gPicList, gSndList, gMovList, gSeparator
  2.  
  3. on startMovie
  4.   set the trace to 0
  5.   unLoad()
  6.   unloadMember()
  7.   set gMachineType to the machineType
  8.   if gMachineType <> 256 then
  9.     if factory("FixPalette") = 0 then
  10.       openXLib("WRONGPAL.XOB")
  11.     end if
  12.     if factory("FixPalette") <> 0 then
  13.       set fixPal to fixPalette(mnew, the stageLeft, the stageTop, the stageRight, the stageBottom)
  14.       fixPal(mPatchIt)
  15.     end if
  16.   end if
  17.   setProp(1, 48, "puppet", 0)
  18.   setProp(1, 48, "visibility", 1)
  19.   set gMovieSprite to 15
  20.   set the fileName of cast "INTRO.MOV" to the pathName & "DigiLogo.MOV"
  21. end
  22.  
  23. on launchMovie
  24.   if the machineType = 256 then
  25.     set gSeparator to "\"
  26.   else
  27.     set gSeparator to ":"
  28.   end if
  29.   openFile(the pathName, "asia")
  30.   if the result = 1 then
  31.     exit
  32.   end if
  33.   if the machineType <> 256 then
  34.     openFile("VSexAsia", "asia")
  35.     if the result = 1 then
  36.       exit
  37.     end if
  38.   end if
  39.   set x to "I could not find any data files" & RETURN & "pertaining to this application." & RETURN & RETURN
  40.   set x to x & "Please try again, from the CD-ROM."
  41.   alert(x)
  42.   halt()
  43. end
  44.  
  45. on openFile whichPath, whichFile
  46.   if the last char in whichPath <> gSeparator then
  47.     set whichPath to whichPath & gSeparator
  48.   end if
  49.   set gPathName to whichPath
  50.   siftFileNames(gPathName)
  51.   if not voidp(whichFile) then
  52.     set gFileName to lowercase(whichFile)
  53.   end if
  54.   put RETURN
  55.   attemptOpen(gDxrList, gFileName & ".dxr")
  56.   if the result = 1 then
  57.     return 1
  58.     exit
  59.   end if
  60.   attemptOpen(gDirList, gFileName & ".dir")
  61.   if the result = 1 then
  62.     return 1
  63.     exit
  64.   end if
  65.   attemptOpenBuild(gDirList, gFileName & ".dir")
  66.   return the result
  67. end
  68.  
  69. on siftFileNames whichPath
  70.   set gFolderList to []
  71.   set gFileList to []
  72.   set gDirList to []
  73.   set gDxrList to []
  74.   set gCstList to []
  75.   set gIniList to []
  76.   set gDllList to []
  77.   set gTxtList to []
  78.   set gPicList to []
  79.   set gSndList to []
  80.   set gMovList to []
  81.   set the itemDelimiter to "."
  82.   set gFileName to lowercase(item 1 of the movie)
  83.   repeat with x = 1 to the maxinteger
  84.     set fileX to getNthFileNameInFolder(whichPath, x)
  85.     set fileX to lowercase(fileX)
  86.     case fileX of
  87.       EMPTY:
  88.         exit repeat
  89.       otherwise:
  90.         set fileExtension to char 1 to 3 of item 2 of fileX
  91.         case fileExtension of
  92.           EMPTY:
  93.             append(gFolderList, fileX)
  94.           otherwise:
  95.             append(gFileList, fileX)
  96.             case fileExtension of
  97.               "dir":
  98.                 append(gDirList, fileX)
  99.               "dxr":
  100.                 append(gDxrList, fileX)
  101.               "cst":
  102.                 append(gCstList, fileX)
  103.               "ini":
  104.                 append(gIniList, fileX)
  105.               "dll":
  106.                 append(gDllList, fileX)
  107.               "txt", "dat", "dta":
  108.                 append(gTxtList, fileX)
  109.               "pct", "pic", "gif":
  110.                 append(gPicList, fileX)
  111.               "aif", "snd", "wav":
  112.                 append(gSndList, fileX)
  113.               "avi", "mov":
  114.                 append(gMovList, fileX)
  115.             end case
  116.         end case
  117.     end case
  118.   end repeat
  119.   set the itemDelimiter to ","
  120. end
  121.  
  122. on attemptOpen whichList, whichName
  123.   case getPos(whichList, whichName) of
  124.     0:
  125.       put "Attempt to open '" & gPathName & whichName & "' failed."
  126.       return 0
  127.       exit
  128.     otherwise:
  129.       put "Attempt to open '" & gPathName & whichName & "' successful."
  130.       go(1, gPathName & whichName)
  131.       return 1
  132.       abort()
  133.       exit
  134.   end case
  135. end
  136.  
  137. on attemptOpenBuild whichList, whichName
  138.   set maxCount to count(whichList)
  139.   repeat with x = maxCount down to 1
  140.     set whichFile to getAt(whichList, x)
  141.     if char 1 to the number of chars in whichName of whichFile = whichName then
  142.       put "Attempt to open '" & gPathName & whichFile & "' successful."
  143.       go(1, gPathName & whichFile)
  144.       return 1
  145.       abort()
  146.       exit
  147.     end if
  148.   end repeat
  149.   put "Attempt to open a build version of '" & gPathName & whichName & "' failed."
  150.   return 0
  151. end
  152.  
  153. on makeList listList
  154.   if listp(listList) then
  155.     set countList to count(listList)
  156.     repeat with x = 1 to countList
  157.       set whichList to getAt(listList, x)
  158.       do("global " & whichList)
  159.       do("set " & whichList & "=[ ]")
  160.       do("sort " & whichList)
  161.     end repeat
  162.   else
  163.     if stringp(listList) then
  164.       do("global " & listList)
  165.       do("set " & listList & "=[ ]")
  166.       do("sort " & listList)
  167.     end if
  168.   end if
  169. end
  170.  
  171. on lowercase whichPhrase
  172.   set newPhrase to EMPTY
  173.   set numChars to the number of chars in whichPhrase
  174.   repeat with x = 1 to numChars
  175.     set charX to char x of whichPhrase
  176.     set charToNumX to charToNum(charX)
  177.     if (charToNumX > 64) and (charToNumX < 91) then
  178.       set charX to numToChar(charToNumX + 32)
  179.     end if
  180.     set newPhrase to newPhrase & charX
  181.   end repeat
  182.   return newPhrase
  183. end
  184.  
  185. on uppercase whichPhrase
  186.   set newPhrase to EMPTY
  187.   set numChars to the number of chars in whichPhrase
  188.   repeat with x = 1 to numChars
  189.     set charX to char x of whichPhrase
  190.     set charToNumX to charToNum(charX)
  191.     if (charToNumX > 96) and (charToNumX < 123) then
  192.       set charX to numToChar(charToNumX - 32)
  193.     end if
  194.     set newPhrase to newPhrase & charX
  195.   end repeat
  196.   return newPhrase
  197. end
  198.  
  199. on setInterface whichSprite, whichInterface
  200.   repeat while the mouseDown
  201.     updateStage()
  202.   end repeat
  203.   puppetSprite(9, 0)
  204.   set gWhichInterface to whichInterface
  205.   go(the frame + 1)
  206. end
  207.  
  208. on setProp startSprite, endSprite, whichProp, whichValue
  209.   repeat with x = startSprite to endSprite
  210.     do("set the " & whichProp & " of sprite x=whichValue")
  211.   end repeat
  212. end
  213.  
  214. on delayFor howLong
  215.   set howLong to the timer + howLong
  216.   repeat while the timer < howLong
  217.     updateStage()
  218.   end repeat
  219. end
  220.